package com.lex.mapper;

import com.lex.data.admin.model.LexCmsRole;
import com.lex.data.admin.model.LexCmsRoleMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserRoleMenu {


    //获取平台用户角色信息
    @Select("SELECT r.* FROM lex_cms_role AS r\n" +
            "LEFT JOIN lex_cms_user_role AS u ON r.id = u.role_id\n" +
            "WHERE u.user_id = ${userId}")
    List<LexCmsRole> getUserRoleList(@Param("userId") Long userId);

    //获取平台用户菜单
    @Select("SELECT m.* FROM lex_cms_role_menu AS m\n" +
            "LEFT JOIN lex_cms_user_role AS rm ON m.role_id = rm.role_id\n" +
            "WHERE rm.user_id = ${userId} order by m.menu_id asc")
    List<LexCmsRoleMenu> getUserMenuList(@Param("userId") Long userId);
}
